package com.ctyun.xstore.vod.auth;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 签名参数封装类
 * 
 * @author zhouzhengrong
 *
 */
public final class SignParam {

	private String uri;
	private Set<String> parameterNames;
	private Map<String, List<String>> headers;
	private String accesskey;
	private String secretKey;
	private String zoneDateTime;
	private String httpMethod;

	public SignParam(Builder builder) {
		this.uri = builder.uri;
		this.parameterNames = builder.parameterNames;
		this.headers = builder.headers;
		this.accesskey = builder.accesskey;
		this.secretKey = builder.secretKey;
		this.zoneDateTime = builder.zoneDateTime;
		this.httpMethod = builder.httpMethod;
	}

	public String getUri() {
		return uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	public Set<String> getParameterNames() {
		if(parameterNames == null)
			return Collections.emptySet();
		return parameterNames;
	}

	public void setParameterNames(Set<String> parameterNames) {
		this.parameterNames = parameterNames;
	}

	public Map<String, List<String>> getHeaders() {
		if (headers == null)
			return Collections.emptyMap();
		return headers;
	}

	public void setHeaders(Map<String, List<String>> headers) {
		this.headers = headers;
	}

	public String getAccesskey() {
		return accesskey;
	}

	public void setAccesskey(String accesskey) {
		this.accesskey = accesskey;
	}

	public String getSecretKey() {
		return secretKey;
	}

	public void setSecretKey(String secretKey) {
		this.secretKey = secretKey;
	}

	public String getZoneDateTime() {
		return zoneDateTime;
	}

	public void setZoneDateTime(String zoneDateTime) {
		this.zoneDateTime = zoneDateTime;
	}

	public String getHttpMethod() {
		return httpMethod;
	}

	public void setHttpMethod(String httpMethod) {
		this.httpMethod = httpMethod;
	}

	public static class Builder {
		private String uri;
		private Set<String> parameterNames;
		private Map<String, List<String>> headers;
		private String accesskey;
		private String secretKey;
		private String zoneDateTime;
		private String httpMethod;

		public Builder setUri(String uri) {
			this.uri = uri;
			return this;
		}

		public Builder setParameterNames(Set<String> parameterNames) {
			this.parameterNames = parameterNames;
			return this;
		}

		public Builder setHeaders(Map<String, List<String>> headers) {
			this.headers = headers;
			return this;
		}

		public Builder setAccessKey(String accesskey) {
			this.accesskey = accesskey;
			return this;
		}

		public Builder setSecretKey(String secretKey) {
			this.secretKey = secretKey;
			return this;
		}

		public Builder setZoneDateTime(String zoneDateTime) {
			this.zoneDateTime = zoneDateTime;
			return this;
		}

		public Builder setHttpMethod(String httpMethod) {
			this.httpMethod = httpMethod;
			return this;
		}

		public SignParam build() {
			return new SignParam(this);
		}
	}

}
